//
//  STOrderOverView.m
//  YiYueStore
//
//  Created by zhouzhouzhou on 2018/9/28.
//  Copyright © 2018年 YuYiLian. All rights reserved.
//

#import "STOrderOverView.h"
#import "YLHomeOrderListModel.h"
@implementation STOrderOverView

-(id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    //加载用户信息
    if (self) {
        self.autoresizesSubviews = NO;
        STOrderOverView * userView =  [[NSBundle mainBundle] loadNibNamed:@"STOrderOverView"owner:self options:nil].lastObject;
        self = userView;
        self.frame = frame;
    }
    return self;
}

-(void)setOrderOverViewWithType:(int)type data:(id)data{
    YLHomeOrderListModel * listModel = data;
    if (type == 0) {
        if ([listModel.status intValue] == 13 || [listModel.status intValue] == 14 || [listModel.status intValue] == 15 || [listModel.status intValue] == 3){
            
            self.overTimerNameLab.hidden = YES;
            self.orderNumNameLab.hidden = YES;
            
            self.overTimerLab.hidden = YES;
            self.orderIdLab.hidden = YES;
            self.dayLab.hidden = YES;
            
            self.serNameLab.text = @"服务项目";
            self.hairderNameLab.text = @"服务门店";
            self.reTimerNameLab.text = @"预约时间";
            self.brgTimerNameLab.text = @"订单编号";
            
            self.serviceLab.text = listModel.servicename;
            self.priceLab.text = listModel.orderAmount;
            self.hairderLab.text = listModel.stylistname;
            self.reTimerLab.text = [NSString timechange:listModel.ordertime];
            self.dayLab.text = [NSString stringWithFormat:@"(%@)",listModel.datename];
            self.brginTimerLab.text = listModel.orderno;
        }else if ([listModel.status intValue] == 8){

            self.priceLab.hidden = YES;
            self.dayLab.hidden = YES;
            self.overTimerNameLab.hidden = NO;
            self.orderNumNameLab.hidden = YES;
            
            self.brginTimerLab.hidden = NO;
            self.overTimerLab.hidden = NO;
            self.orderIdLab.hidden = YES;
            
            self.serNameLab.text = @"服务项目";
            self.hairderNameLab.text = @"服务门店";
            self.reTimerNameLab.text = @"预约时间";
            self.brgTimerNameLab.text = @"开始时间";
            self.overTimerNameLab.text = @"订单编号";
            
            self.priceLab.text = listModel.orderAmount;
            self.serviceLab.text = listModel.servicename;
            self.hairderLab.text = listModel.stylistname;
            self.reTimerLab.text = [NSString timechange:listModel.ordertime];
            self.brginTimerLab.text = [NSString timechange:listModel.starttime];
            self.overTimerLab.text = listModel.orderno;
        }
        
        
    }else  if (type == 1){
        if ([listModel.status intValue] == 4){
            
            self.overTimerNameLab.hidden = YES;
            self.orderNumNameLab.hidden = YES;
            
            self.brginTimerLab.hidden = YES;
            self.overTimerLab.hidden = YES;
            self.orderIdLab.hidden = YES;
            self.dayLab.hidden = YES;
            
            
            self.serNameLab.text = @"服务项目";
            self.hairderNameLab.text = @"服务门店";
            self.reTimerNameLab.text = @"预约时间";
            self.brgTimerNameLab.text = @"订单编号";
            
            self.serviceLab.text = listModel.servicename;
            self.hairderLab.text = listModel.stylistname;
            self.reTimerLab.text = [NSString timechange:listModel.ordertime];
            self.brginTimerLab.text = listModel.orderno;
        }else if ([listModel.status intValue] == 7){
            
            self.overTimerNameLab.hidden = YES;
            self.orderNumNameLab.hidden = NO;
            
            self.brginTimerLab.hidden = NO;
            self.overTimerLab.hidden = YES;
            self.orderIdLab.hidden = NO;
            self.priceLab.hidden = YES;
            self.dayLab.hidden = YES;
            
            
            self.serNameLab.text = @"服务项目";
            self.hairderNameLab.text = @"服务门店";
            self.reTimerNameLab.text = @"预约时间";
            self.brgTimerNameLab.text = @"开始时间";
            self.orderNumNameLab.text = @"订单编号";
            
            self.serviceLab.text = listModel.servicename;
            self.hairderLab.text = listModel.stylistname;
            self.reTimerLab.text = [NSString timechange:listModel.ordertime];
            self.brginTimerLab.text = [NSString timechange:listModel.starttime];
            self.orderIdLab.text = listModel.orderno;
        }
        
    }else if (type == 2 ){
        
        self.addressBtn.hidden = NO;
        self.overTimerNameLab.hidden = NO;
        self.orderNumNameLab.hidden = NO;
        
        self.brginTimerLab.hidden = NO;
        self.overTimerLab.hidden = NO;
        self.orderIdLab.hidden = NO;
        self.priceLab.hidden = YES;
        self.dayLab.hidden = YES;
        
        
        self.serNameLab.text = @"服务项目";
        self.hairderNameLab.text = @"服务门店";
        self.reTimerNameLab.text = @"预约时间";
        self.brgTimerNameLab.text = @"开始时间";
        self.overTimerNameLab.text = @"完成时间";
        self.orderNumNameLab.text = @"订单编号";
        
        self.serviceLab.text = listModel.servicename;
        self.hairderLab.text = listModel.stylistname;
        self.reTimerLab.text = [NSString timechange:listModel.ordertime];
        self.brginTimerLab.text = [NSString timechange:listModel.starttime];
        self.overTimerLab.text = [NSString timechange:listModel.endtime];
        self.orderIdLab.text = listModel.orderno;
        
    }else if (type == 3 ){

        self.addressBtn.hidden = NO;
        self.overTimerNameLab.hidden = NO;
        self.orderNumNameLab.hidden = NO;
        
        self.brginTimerLab.hidden = NO;
        self.overTimerLab.hidden = NO;
        self.orderIdLab.hidden = NO;
        self.priceLab.hidden = YES;
        self.dayLab.hidden = YES;
        
        
        self.serNameLab.text = @"服务项目";
        self.hairderNameLab.text = @"服务门店";
        self.reTimerNameLab.text = @"预约时间";
        self.brgTimerNameLab.text = @"开始时间";
        self.overTimerNameLab.text = @"退款时间";
        self.orderNumNameLab.text = @"订单编号";
        
        self.serviceLab.text = listModel.servicename;
        self.hairderLab.text = listModel.stylistname;
        self.reTimerLab.text = [NSString timechange:listModel.ordertime];
        self.brginTimerLab.text = [NSString timechange:listModel.starttime];
        self.overTimerLab.text = [NSString timechange:listModel.refundtime];
        self.orderIdLab.text = listModel.orderno;
    }
}




- (IBAction)actionChangeTimer:(id)sender {
    if ([self.delegate respondsToSelector:@selector(STOrderOverViewIditTime)]) {
        [self.delegate STOrderOverViewIditTime];
    }
}

- (IBAction)actionGetAddress:(id)sender {
    if ([self.delegate respondsToSelector:@selector(STOrderOverViewGetAddress)]) {
        [self.delegate STOrderOverViewGetAddress];
    }
}

@end
